package com.eastfair.venuebooking.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 场馆预定审核表
 * </p>
 *
 * @author dqq
 * @date 2023-03-21
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "VenueBookAuditVenueBookSourceEnum", description = "场馆预定申请来源 #{CONFERENCE:展览会议系统;VENUE_WEBSITE:场馆官网-枚举")
public enum VenueBookAuditVenueBookSourceEnum implements BaseEnum {

    /**
     * CONFERENCE="展览会议系统"
     */
    CONFERENCE("展览会议系统"),
    /**
     * VENUE_WEBSITE="场馆官网"
     */
    VENUE_WEBSITE("场馆官网"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static VenueBookAuditVenueBookSourceEnum match(String val, VenueBookAuditVenueBookSourceEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static VenueBookAuditVenueBookSourceEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(VenueBookAuditVenueBookSourceEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "CONFERENCE,VENUE_WEBSITE", example = "CONFERENCE")
    public String getCode() {
        return this.name();
    }

}
